import { useUserStore } from "@/store/user";
import { App } from "vue";

export const regPermission = (app: App<Element>) => {
  app.directive("permission", {
    mounted(el, binding) {
      const store = useUserStore();
      if (!store.permissions.includes(binding.value)) {
        el.remove();
      }
    },
  });
};
